﻿using System;
using System.Collections.Generic;
using System.Web;

namespace Decode.Umb
{
	public class Paths
	{
		private static string _rootUrl;

		public static string RootUrl
		{
			get
			{
				if (_rootUrl == null)
				{
					_rootUrl = string.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme,
															 HttpContext.Current.Request.Url.Authority,
															 HttpContext.Current.Request.ApplicationPath);

					if (_rootUrl.EndsWith("/"))
						_rootUrl = _rootUrl.Substring(0, _rootUrl.Length - 1);
				}

				return _rootUrl;
			}
		}
	}
}